"""fix lessons models

Revision ID: ecb681cdff62
Revises: 268f02f42fb6
Create Date: 2024-04-24 18:41:36.407531

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'ecb681cdff62'
down_revision: Union[str, None] = '268f02f42fb6'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('Checks', sa.Column('lesson_id', sa.Integer(), nullable=False))
    op.create_foreign_key(None, 'Checks', 'Users', ['lesson_id'], ['id'])
    op.create_unique_constraint(None, 'Lessons', ['id'])
    op.create_unique_constraint(None, 'Spaces', ['id'])
    op.add_column('TrainingChecks', sa.Column('repetitions', sa.Integer(), nullable=False))
    op.add_column('TrainingChecks', sa.Column('assessment', sa.Integer(), nullable=False))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('TrainingChecks', 'assessment')
    op.drop_column('TrainingChecks', 'repetitions')
    op.drop_constraint(None, 'Spaces', type_='unique')
    op.drop_constraint(None, 'Lessons', type_='unique')
    op.drop_constraint(None, 'Checks', type_='foreignkey')
    op.drop_column('Checks', 'lesson_id')
    # ### end Alembic commands ###
